package com.ruoyi.ipms_patent.service.impl;

import com.ruoyi.ipms_patent.dto.OfficialInfoDto;
import com.ruoyi.ipms_patent.entity.OfficialInfo;
import com.ruoyi.ipms_patent.mapper.OfficialInfoMapper;
import com.ruoyi.ipms_patent.service.OfficialInfoService;
import com.ruoyi.ipms_patent.service.TestService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*官文通知业务实现类*/
@Service
public class OfficialInfoServiceImpl implements OfficialInfoService {

    @Resource
    private OfficialInfoMapper officialInfoMapper;

    @Override
    public OfficialInfo addOfficialInfo(OfficialInfo info) {
        int result = officialInfoMapper.insertOne(info);
        return result > 0 ? info : null;
    }

    @Override
    public OfficialInfo findOneById(Integer id) {
        return officialInfoMapper.selectOneById(id);
    }

    @Override
    public List<OfficialInfo> findOfficialInfoList(Integer caseId) {
        return officialInfoMapper.selectList(caseId);
    }

    /*返回dto 联表查询*/
    @Override
    public List<OfficialInfoDto> findOfficialInfoList2(Integer caseId) {
        return officialInfoMapper.selectDtoList(caseId);
    }

    @Override
    public boolean modifyOfficialInfo(OfficialInfo info) {
        return officialInfoMapper.updateOne(info) > 0;
    }

    @Override
    public boolean removeOfficialInfo(Integer id) {
        return officialInfoMapper.deleteOne(id) > 0;
    }
}